<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>MIHF Internal Architecture</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="ODTONE 0.3">
<link rel="up" href="../mihf_index.html" title="ODTONE-MIHF">
<link rel="prev" href="mihf_getStart.html" title="Getting Started">
<link rel="next" href="mihf_internals.html" title="ODTONE MIHF internals">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="'ODTONE - Open Dot Twenty One'" width="100" height="100" src="../../.././images/logo.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mihf_getStart.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mihf_index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mihf_internals.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="MIHF Internal Architecture">
<div class="titlepage"><div><div><h4 class="title">
<a name="odtone.app.mihf_index.mihf_internal_arch"></a><a class="link" href="mihf_internal_arch.html" title="MIHF Internal Architecture"> MIHF Internal
        Architecture</a>
</h4></div></div></div>
<div class="section" title="MIHF Architecture overview">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.mihf_index.mihf_internal_arch.mihf_architecture_overview"></a><a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.mihf_architecture_overview" title="MIHF Architecture overview">MIHF
          Architecture overview</a>
</h5></div></div></div>
<p>
            <span class="inlinemediaobject"><img src="../../.././images/mihf_arch.png" alt="mihf_arch"></span>
          </p>
</div>
<a name="odtone.app.mihf_index.mihf_internal_arch.components"></a><h6>
<a name="id3099461"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.components">Components</a>
        </h6>
<a name="odtone.app.mihf_index.mihf_internal_arch.listening_services__classes__emphasis_udp_listner__emphasis__and__emphasis_tcp_listner__emphasis_"></a><h6>
<a name="id3099480"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.listening_services__classes__emphasis_udp_listner__emphasis__and__emphasis_tcp_listner__emphasis_">Listening
          Services: classes <span class="emphasis"><em>udp_listner</em></span> and <span class="emphasis"><em>tcp_listner</em></span></a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/listening_services.jpg" alt="listening_services"></span>
        </p>
<p>
          The classes <span class="emphasis"><em>udp_listener</em></span> and <span class="emphasis"><em>tcp_listener</em></span>
          are wrappers around the boost::asio::ip::udp and boost::asio::ip::tcp and
          are responsible for handling UDP and TCP communications, respectively.
        </p>
<p>
          The MIHF receives messages from two different sources, other MIHFs and
          local SAPs. If a message is from another MIHF, the message must be processed
          by the transaction state machines, as defined in the standard. If it is
          from a local SAP the transaction state machines are bypassed to reduce
          the number of messages exchanged locally.
        </p>
<p>
          A dispatch method is supplied when a listening service is instantiated
          and is called when a valid message is received.
        </p>
<p>
          If the listening service is responsible for remote communications, a reference
          to a <span class="emphasis"><em>message_in</em></span> instance should be passed on the constructor.
          If it is responsible for local communications, a reference to the <span class="emphasis"><em>sac_dispatch</em></span>
          method should be supplied.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.message_in"></a><h6>
<a name="id3099579"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.message_in">message_in</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/message_in.jpg" alt="message_in"></span>
        </p>
<p>
          The <span class="emphasis"><em>message_in</em></span> checks the transaction_pool for a pending
          transaction for the incoming message, or if a new source transaction must
          be created and then added to the transaction pool.
        </p>
<p>
          Then proceeds to run the newly created, or found, transaction.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.service_access_controller"></a><h6>
<a name="id3099634"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.service_access_controller">Service
          Access Controller</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/service_access_controller.jpg" alt="service_access_controller"></span>
        </p>
<p>
          The service access controller is split in <span class="emphasis"><em>sac_dispatch</em></span>
          and <span class="emphasis"><em>sac_process_message</em></span>, because the transaction state
          machines, defined in the standard, expect a global function that processes
          the incoming message and returns a boolean indicating that a response message
          was generated. This complicates matters because we don't want to run the
          local messages through the transaction state machines.
        </p>
<p>
          The <span class="emphasis"><em>sac_dispatch</em></span> is called by the local communications
          listening service and checks if the message id is supported. If so, the
          message is processed by a previously declared handler.
        </p>
<p>
          The <span class="emphasis"><em>sac_process_message</em></span> is a global function called
          by the transaction state machines that checks if the message id is supported
          by the MIHF, but doesn't try to send the message directly, it just returns
          to the transaction state machine that called it. Registering a callback
          handler for a MIH message is done with the <span class="emphasis"><em>sac_register_callback</em></span>
          function.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.mihf_services"></a><h6>
<a name="id3099721"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.mihf_services">MIHF
          Services</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/mihf_services.jpg" alt="mihf_services"></span>
        </p>
<p>
          These refer to the Event Service, Command Service, Service Management and
          Information Service that are responsible for handling the different kind
          of messages.
        </p>
<p>
          A local transaction pool is supplied to handle pending transactions from
          local SAPs. A user might request to send a message to a peer MIHF, and
          in order to forward it the response some state must be stored.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.transmit"></a><h6>
<a name="id3099777"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.transmit">transmit</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/transmit.jpg" alt="transmit"></span>
        </p>
<p>
          This class is used by the MIHFs services and checks if the MIH destination
          identifier of the message is in the local address book. If it is, the message
          is for a local SAP and the udp_send method is called to send the message.
          If it's not in the local address book the message is forwarded to the
          <span class="emphasis"><em>message_out</em></span>.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.message_out"></a><h6>
<a name="id3099828"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.message_out">message_out</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/message_out.jpg" alt="message_out"></span>
        </p>
<p>
          Checks, in the transaction pool, if the outgoing message belongs to a pending
          transaction, if so the transaction is run and eventually the message is
          sent.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.net_sap"></a><h6>
<a name="id3099875"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.net_sap">net_sap</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/net_sap.jpg" alt="net_sap"></span>
        </p>
<p>
          This class, when called, checks if the MIH destination identifier is in
          the remote address book, if so the message is sent using on of <span class="emphasis"><em>udp_send</em></span>
          or <span class="emphasis"><em>tcp_send</em></span>.
        </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.udp_send_and_tcp_send"></a><h6>
<a name="id3099928"></a>
          <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.udp_send_and_tcp_send">udp_send
          and tcp_send</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="../../.././images/udp_send_and_tcp_send.jpg" alt="udp_send_and_tcp_send"></span>
        </p>
<p>
          These are functions that send a message using the specified protocol.
        </p>
<p>
          The classes <span class="emphasis"><em>udp_send</em></span> and <span class="emphasis"><em>tcp_send</em></span>
          are responsible for handling UDP and TCP communications, respectively.
        </p>
<div class="section" title="Helper classes">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.mihf_index.mihf_internal_arch.helper_classes"></a><a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.helper_classes" title="Helper classes">Helper
          classes</a>
</h5></div></div></div>
<a name="odtone.app.mihf_index.mihf_internal_arch.helper_classes.meta_message"></a><h6>
<a name="id3100004"></a>
            <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.helper_classes.meta_message">meta_message</a>
          </h6>
<p>
            A <span class="emphasis"><em>meta_message</em></span> is a derived class from <a class="link" href="../../library/index_mih/odtone_mih_message_class.html" title="2.1. odtone::mih::message Class Reference">odtone::mih::message</a>
            with added metadata.
          </p>
<p>
            The metadata indicates if the message was received on the loopback interface
            and also the IP address and port of the sender of the message. It's useful
            mostly due to broadcast messages.
          </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.helper_classes.entities_books"></a><h6>
<a name="id3100050"></a>
            <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.helper_classes.entities_books">Entities
            books</a>
          </h6>
<p>
            <span class="inlinemediaobject"><img src="../../.././images/entities_book.jpg" alt="entities_book"></span>
          </p>
<p>
            <span class="bold"><strong>address_book</strong></span>
          </p>
<p>
            Address book is used to store information about all known peer MIHFs.
            It makes the correspondence between the MIHF MIH Identifier and the informations
            stored in the address_entry struct.
          </p>
<p>
            <span class="bold"><strong>link_book</strong></span>
          </p>
<p>
            Link book is used to store information about all known Link SAPs. It
            makes the correspondence between the Link SAP MIH Identifier and the
            informations stored in the link_entry struct.
          </p>
<p>
            <span class="bold"><strong>user_book</strong></span>
          </p>
<p>
            User book is used to store information about all known MIH Users. It
            makes the correspondence between the MIH User MIH Identifier and the
            informations stored in the user_entry struct.
          </p>
<a name="odtone.app.mihf_index.mihf_internal_arch.helper_classes.transactions"></a><h6>
<a name="id3100140"></a>
            <a class="link" href="mihf_internal_arch.html#odtone.app.mihf_index.mihf_internal_arch.helper_classes.transactions">Transactions</a>
          </h6>
<p>
            <span class="inlinemediaobject"><img src="../../.././images/transaction_pool.jpg" alt="transaction_pool"></span> <span class="inlinemediaobject"><img src="../../.././images/local_transaction_pool.jpg" alt="local_transaction_pool"></span>
          </p>
<p>
            The classes <span class="emphasis"><em>transaction_pool</em></span> and <span class="emphasis"><em>local_transaction_pool</em></span>
            are responsible for handling active remote and local transactions, respectively.
          </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2009 -2011 Universidade Aveiro<br>Copyright &#169; 2009 -2011 Instituto de Telecomunica&#231;&#245;es - P&#243;lo Aveiro<p>
        This software is distributed under a license. The full license agreement
        can be found in the LICENSE in this distribution. This software may not be
        copied, modified, sold or distributed other than expressed in the named license
        agreement. This software is distributed without any warranty.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mihf_getStart.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mihf_index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mihf_internals.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
